<ion-view class="bg">
  <ion-header-bar class="bar bar-positive">
    <button class="button back-button buttons icon ion-ios-arrow-left button-clear" nav-direction="back" ng-click="$ionicGoBack()">返回</button>
    <h3 class="title">受理开单</h3>
    <button class="button button-icon icon ion-ios-search" ui-sref="myOrder({htmlId:'addWaybill'})"></button>
  </ion-header-bar>
  <ion-content>
      <div class="list card">
          <label class="item item-input div">
            <i class="input-label col-25" >承运单号</i>
            <input type="text" placeholder="手动输入单号" maxlength="20" id="WAYBILL_NO" ng-model="waybill.info.WAYBILL_NO" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
          </label>
          <label class="item item-input div">
              <i class="input-label col-25" >承运日期</i>
              <button class="button button-block date button-clear" ng-click="showDate()" style="color: black;">{{waybill.info.WAYBILL_DATE | date : "yyyy年MM月dd日"}}</button>
          </label>
          <label class="item item-input item-select div">
              <i class="input-label col-25" >到达站</i>
              <select id="site">
                <option ng-repeat="i in sites" value="{{i.DEPT_ID}}">{{i.NAME}}</option>
              </select>
          </label>
          <label class="item item-input div">
            <i class="input-label col-25" >目的地</i>
            <input type="text" placeholder="请输入目的地" maxlength="10" ng-model="waybill.info.DESTINATION_STATION">
          </label>
          <div class="item item-input item-divider div" ng-click="modalConsignee.show()">
              <img src="img/shr_logo.png" class="typeIcon" style="height: 25px;">
              <i class="dark">收货人</i>
              <i class="ion ion-ios-paper-outline chooseIcon"></i>
          </div>
          <div class="item item-input div">
            <i class="icon ion-asterisk assertive required"></i>
            <input type="tel" class="col-50" placeholder="电话" maxlength="11" id="CONSIGNEE_PHONE" ng-change="changePhone(waybill.customerMap.CONSIGNEE_PHONE,1)" ng-model="waybill.customerMap.CONSIGNEE_PHONE">
            <i class="icon ion-asterisk assertive required"></i>
            <input type="text" class="col-50" placeholder="姓名" maxlength="8" id="CONSIGNEE" ng-model="waybill.customerMap.CONSIGNEE">
          </div>
          <!--<div class="item item-input div" style="padding-left: 5px;">-->
            <!--<div class="row">-->
              <!--<select id="provinceS" class="proCity">-->
                <!--<option>地区选择</option>-->
                <!--<option ng-repeat="pros in provinceData" value="{{pros.id}}">{{pros.name}}</option>-->
              <!--</select>-->
              <!--<select id="cityS" class="proCity">-->
                <!--<option ng-repeat="cit in cityDataS" value="{{cit.id}}">{{cit.name}}</option>-->
              <!--</select>-->
              <!--<select id="areaS" class="proCity">-->
                <!--<option ng-repeat="are in areaDataS" value="{{are.id}}">{{are.name}}</option>-->
              <!--</select>-->
            <!--</div>-->
          <!--</div>-->
          <label class="item item-input div">
              <input type="text" placeholder="地址" maxlength="30" id="CONSIGNEE_ADDRESS" ng-model="waybill.customerMap.CONSIGNEE_ADDRESS">
          </label>
          <div class="item item-input item-divider div" ng-click="modalShipper.show()">
              <img src="img/fhr_logo.png" class="typeIcon" style="height: 25px;">
              <i class="dark">发货人</i>
              <i class="ion ion-ios-paper-outline chooseIcon"></i>
          </div>
          <div class="item item-input div">
            <i class="icon ion-asterisk assertive required"></i>
            <input type="tel" maxlength="11"  class="col-50" placeholder="电话" id="SHIPPER_PHONE" ng-change="changePhone(waybill.customerMap.SHIPPER_PHONE,2)" ng-model="waybill.customerMap.SHIPPER_PHONE">
            <i class="icon ion-asterisk assertive required"></i>
            <input type="text" class="col-50" placeholder="姓名" maxlength="8" id="SHIPPER" ng-model="waybill.customerMap.SHIPPER">
          </div>
          <!--<div class="item item-input div" style="padding-left: 5px;">-->
            <!--<div class="row">-->
              <!--<select id="provinceF" class="proCity">-->
                <!--<option>地区选择</option>-->
                <!--<option ng-repeat="pros in provinceData" value="{{pros.id}}">{{pros.name}}</option>-->
              <!--</select>-->
              <!--<select id="cityF" class="proCity">-->
                <!--<option ng-repeat="cit in cityDataF" value="{{cit.id}}">{{cit.name}}</option>-->
              <!--</select>-->
              <!--<select id="areaF" class="proCity">-->
                <!--<option ng-repeat="are in areaDataF" value="{{are.id}}">{{are.name}}</option>-->
              <!--</select>-->
            <!--</div>-->
          <!--</div>-->
          <label class="item item-input div">
              <input type="text" placeholder="地址" maxlength="30" id="SHIPPER_ADDRESS" ng-model="waybill.customerMap.SHIPPER_ADDRESS">
          </label>
          <div class="item item-input item-divider div">
              <img src="img/fhxx_logo.png" class="typeIcon" style="height: 25px;">
              <i class="dark">发货信息</i>
          </div>
          <div class="item item-input div">
            <i class="icon ion-asterisk assertive required"></i>
            <input type="text" class="col-50" placeholder="货物名称" maxlength="7" id="GOODS_NAME" ng-model="waybill.goodsInfo.GOODS_NAME">
            <i class="icon ion-asterisk assertive required" style="margin-left: 20px;"></i>
            <input type="number" class="col-50" placeholder="件数" id="PIECES" ng-model="waybill.goodsInfo.PIECES" onkeyup="this.value=this.value.replace(/\D/g,'')" oninput="if(value.length>8)value=value.slice(0,8)">
            <span class="company">件</span>
          </div>
          <div class="item item-input div">
            <input type="number" class="col-50 twoDot" id="WEIGHT" placeholder="重量" maxlength="8" ng-model="waybill.goodsInfo.WEIGHT" onkeypress="this.value = this.value.slice(0, 7)">
            <span class="company">kg</span>
            <input type="number" maxlength="8" class="col-50 twoDot" id="VOLUME" placeholder="体积" ng-model="waybill.goodsInfo.VOLUME" onkeypress="this.value = this.value.slice(0, 7)">
            <span class="company">㎥</span>
          </div>
          <label class="item item-input item-select div">
            <i class="input-label col-25">包装</i>
            <select id="GOODS_PACK">
              <option ng-repeat="i in packTypes" value="{{i.key}}">{{i.value}}</option>
            </select>
          </label>
          <label class="item item-input item-select div">
            <i class="input-label col-25" >送货方式</i>
            <select id="DELIVERY_TYPE">
              <option selected value="0">自提</option>
              <option value="1">送货</option>
              <option value="2">上楼</option>
            </select>
          </label>
          <div class="item item-input item-divider div" ng-click="addCost()">
            <img src="img/fy_logo.png" class="typeIcon" style="height: 25px;">
            <i class="dark">费用</i>
            <i class="ion ion-ios-paper-outline chooseIcon ion-plus-round"></i>
          </div>
          <label class="item item-input item-select div">
            <i class="input-label col-25" >付款方式</i>
            <select id="paymentMethod">
              <option ng-repeat="i in paymentMethods" value="{{i.key}}">{{i.value}}</option>
            </select>
          </label>
          <label class="item item-input div" id="FREIGHT_AMOUNT">
            <i class="input-label col-25" >运费</i>
            <input type="number" class="twoDot" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.FREIGHT_AMOUNT" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >现付</i>
            <input type="number" class="twoDot" id="SPOT_PAYMENT" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.SPOT_PAYMENT" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >到付</i>
            <input type="number" class="twoDot" id="TO_PAYMENT" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.TO_PAYMENT" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >欠付</i>
            <input type="number" class="twoDot" id="BACK_PAY" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.BACK_PAY" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >回付</i>
            <input type="number" class="twoDot" id="BACK_TO_PAY" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.BACK_TO_PAY" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >月结</i>
            <input type="number" class="twoDot" id="MONTHLY_BALANCE" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.MONTHLY_BALANCE" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >货到打卡</i>
            <input type="number" class="twoDot" id="GOODS_TO_CLOCK" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.GOODS_TO_CLOCK" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div isDisplay hide">
            <i class="input-label col-25" >代扣</i>
            <input type="number" class="twoDot" id="WITHHOLD" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.WITHHOLD" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <div class="item item-input div">
            <i class="input-label col-25">提货费</i>
            <input type="number" class="twoDot" id="PICK_UP_COST" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.PICK_UP_COST" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
            <i class="input-label col-20">送货费</i>
            <input type="number" class="twoDot" id="DROP_OFF" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.DROP_OFF" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
          </div>
          <div class="item item-input div">
            <i class="input-label col-25" >声明价值</i>
            <input type="number" class="twoDot" id="DECLARE_VALUE" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.DECLARE_VALUE" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
            <i class="input-label col-20" >保费</i>
            <input type="number" class="twoDot" id="PREMIUM" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.PREMIUM" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
          </div>
          <div class="item item-input div hide" id="nowOwe" on-hold="holdOnRemove(1)">
            <i class="input-label col-25" >现返</i>
            <input type="number" class="twoDot" id="BACK_NOW" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.BACK_NOW" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
            <i class="input-label col-20" >欠返</i>
            <input type="number" class="twoDot" id="OWE_TO_RETURN" placeholder="请输入金额" maxlength="8" ng-model="waybill.payMap.OWE_TO_RETURN" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
          </div>
          <label class="item item-input div hide" id="freightAdv" on-hold="holdOnRemove(2)">
            <i class="input-label col-25" >运费垫付</i>
            <input type="number" class="twoDot" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.PAYMENT_FREIGHT" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <div class="item item-input div hide" id="agencyFund" on-hold="holdOnRemove(3)">
            <i class="input-label col-25">代收款</i>
            <input type="number" class="twoDot" id="AGENCY_FUND" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.AGENCY_FUND" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
            <i class="input-label col-20">手续费</i>
            <input type="number" class="twoDot" id="POINTS" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.POINTS" onkeypress="this.value = this.value.slice(0, 9)" style="padding-right: 0px;">
          </div>
          <label class="item item-input div hide" id="agenFdAdv" on-hold="holdOnRemove(4)">
            <i class="input-label col-25" >代收款垫付</i>
            <input type="number" class="twoDot" placeholder="请输入金额" maxlength="8" ng-model="waybill.costMap.PAY_COLLECTION" onkeypress="this.value = this.value.slice(0, 9)">
          </label>
          <label class="item item-input div">
            <i class="input-label col-25" >回单份数</i>
            <input type="number" placeholder="请输入回单份数" maxlength="2" ng-model="waybill.info.RECEIPT_NUM" onkeyup="this.value=this.value.replace(/\D/g,'')" onkeypress="this.value = this.value.slice(0, 1)">
          </label>
          <label class="item item-input item-select div">
            <i class="icon ion-asterisk assertive required"></i>
            <i class="input-label col-25" >业务员</i>
            <select id="userDept">
              <option ng-repeat="i in userDepts" value="{{i.CNO}}">{{i.CNAME}}</option>
            </select>
          </label>
          <div class="item item-input">
            <textarea type="text" placeholder="备注" maxlength="30" ng-model="waybill.info.REMARK" style="height: 80px;"></textarea>
          </div>
      </div>
  </ion-content>
  <ion-footer-bar>
      <a class="button button-positive save" id="save" ng-click="saveWaybill()">保存</a>
      <a class="button button-positive print" id="print" ng-click="printWaybill($event)">打印</a>
  </ion-footer-bar>
</ion-view>
